﻿using System;
using System.Collections.Generic;
using System.Text;

namespace _20_Strategy
{
    /// <summary>
    /// 策略模式和工厂模式方法的应用
    /// </summary>
    public class Demo
    {
        /// <summary>
        /// 获取学生的学号和分数
        /// </summary>
        /// <param name="students"></param>
        /// <returns></returns>
        public Dictionary<int, string> GetScoreName(List<Student> students)
        {
            var result = new Dictionary<int, string>(); 
            foreach (var student in students)
            {
                if (student.Score<60)
                {
                    result.Add(student.Id, "差");
                }
                if (student.Score<70 && student.Score>=60)
                {
                    result.Add(student.Id, "中");
                }
                if (student.Score<80 && student.Score>=70)
                {
                    result.Add(student.Id, "良");
                }
                if (student.Score>=80)
                {
                    result.Add(student.Id, "优");
                }
            }
            return result;
        }

    }
}
